#pragma once

#pragma unmanaged

#include <BWSAL\InformationManager.h>

#pragma managed

#include "..\AiBase.h"
#include "Interfaces\IInformationManager.h"

namespace BroodWar
{
	namespace Addon
	{
		/// <summary>
		/// Uses logic to infer things. For example, if you see a Corsair, the information manager will know a Stargate was created at
		/// some point, and determines an upper bound on when it was created. Also if you see a unit and never saw an onUnitDestroy message
		/// for it, the information manager will assume it still exists. Also keeps track of last seen positions of each unit and the time
		/// the unit was last seen. 
		/// </summary>
		public ref class InformationManager : public AiBase, IInformationManager
		{
		internal:
			BWSAL::InformationManager* instance;

			InformationManager();
			~InformationManager();
			!InformationManager();

			static InformationManager^ s_instance;
		public:
			static property InformationManager^ Instance { InformationManager^ get(); }

			virtual void OnUnitDiscover(Unit^ unit) override;
			virtual void OnUnitEvade(Unit^ unit) override;
			virtual void OnUnitDestroy(Unit^ unit) override;
			virtual Player^ GetPlayer(Unit^ unit);
			virtual Api::UnitType^ GetType(Unit^ unit);
			virtual Position^ GetLastPosition(Unit^ unit);
			virtual int GetLastSeenTime(Unit^ unit);
			virtual bool Exists(Unit^ unit);
			virtual bool EnemyHasBuilt(Api::Enum::UnitType type);
			virtual int GetBuildTime(Api::Enum::UnitType type);
			virtual property HashSet<BaseLocation^>^ EnemyBases { HashSet<BaseLocation^>^ get(); };
			virtual void SetBaseEmpty(BaseLocation^ base);
		};
	}
}
